package com.hangzhou.welbeing.welbeinginstrument.activity;

import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.ProgressBar;

import com.hangzhou.welbeing.welbeinginstrument.R;
import com.hangzhou.welbeing.welbeinginstrument.config.RBConstants;
import com.hangzhou.welbeing.welbeinginstrument.utils.Utils;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 时间 2017 年 08 月 27 日
 * 作者  Z2043 welbeing to hangzou com.hangzhou.welbeing.pregnant.welbeing_pregnant.activity
 * @desc 文章页面
 */
public class ArticlesActivity extends Activity {
    @Bind(R.id.activity_articles_iv_return)
    ImageView mActivityArticlesIvReturn;
    @Bind(R.id.activity_articles_iv_shared)
    ImageView mActivityArticlesIvShared;
    @Bind(R.id.activity_articles_wb_content)
    WebView mActivityArticlesWbContent;
    @Bind(R.id.activity_articles_ProgressBar)
    ProgressBar mActivityArticlesProgressBar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_articles);
        ButterKnife.bind(this);


        Utils.setStatusBar(this,false,false);
        Utils.setStatusTextColor(true,this);
       String arit_id =  getIntent().getStringExtra("arit_id");
        mActivityArticlesWbContent.setWebViewClient(new WebViewClient(){
            @Override
            public void onPageStarted(WebView view, String url, Bitmap favicon) {
                super.onPageStarted(view, url, favicon);}

            @Override
            public void onPageFinished(WebView view, String url) {
                super.onPageFinished(view, url);
                mActivityArticlesProgressBar.setVisibility(View.GONE);
            }
        });
        mActivityArticlesWbContent.loadUrl(RBConstants.SERVER_URL+RBConstants.READING_EVERYDAY_DETAILS_PAGEE+arit_id);
    }

    @OnClick({R.id.activity_articles_iv_return, R.id.activity_articles_iv_shared})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.activity_articles_iv_return:
                finish();
                break;
            case R.id.activity_articles_iv_shared:
                break;
        }
    }
}
